﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLVMBProject
{
    public partial class frmMain : Form
    {
        public string username;
        public frmMain()
        {
            InitializeComponent();
            // Quan Ve Ban Ve
            TreeNode qlBanVe = new TreeNode();
            qlBanVe.Name = "qlBanVe";
            qlBanVe.Text = "Quản Lý Bán Vé";
            this.treeViewHeThong.Nodes.Add(qlBanVe);
            
            TreeNode banve = new TreeNode();
            banve.Name = "BanVe";
            banve.Text = "Bán Vé ";
            this.treeViewHeThong.Nodes["qlBanVe"].Nodes.Add(banve);

          
            TreeNode datve = new TreeNode();
            datve.Name = "DatVe";
            datve.Text = "Đặt Vé ";
            this.treeViewHeThong.Nodes["qlBanVe"].Nodes.Add(datve);

            // Quan Lý Chuyen bay
            TreeNode qlChuyenBay = new TreeNode();
            qlChuyenBay.Name = "qlChuyenBay";
            qlChuyenBay.Text = "Quản Lý CHuyến Bay";
            this.treeViewHeThong.Nodes.Add(qlChuyenBay);

            TreeNode lichbay = new TreeNode();
            lichbay.Name = "lichbay";
            lichbay.Text = "Nhận Lịch Bay";
            this.treeViewHeThong.Nodes["qlChuyenBay"].Nodes.Add(lichbay);
            
            //Quan ly Nhan Vien 
            TreeNode qlNhanVien = new TreeNode();
            qlNhanVien.Text = "Quản Lý Nhân Viên";
            qlNhanVien.Name = "qlNhanVien";
            this.treeViewHeThong.Nodes.Add(qlNhanVien);
            // tra cuu chuyen bay 
            TreeNode tcChuyenBay = new TreeNode();
            tcChuyenBay.Name = "tcChuyenBay";
            tcChuyenBay.Text = "Tra Cứu Chuyến Bay";
            this.treeViewHeThong.Nodes.Add(tcChuyenBay);
        }

        private void treeViewHeThong_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                string nameNode = treeViewHeThong.SelectedNode.Name.ToString();
                switch (nameNode)
                {
                    case"BanVe":
                         this.pnUCtrl.Controls.Clear();
                         ctrBanVe ctBanVe = new ctrBanVe();
                        this.pnUCtrl.Controls.Add(ctBanVe);
                        break;
                    case"DatVe":
                        this.pnUCtrl.Controls.Clear();
                        ctrDatVe ctDatVe = new ctrDatVe();
                        this.pnUCtrl.Controls.Add(ctDatVe);
                        break;
                    case "tcChuyenBay":
                        this.pnUCtrl.Controls.Clear();
                        ctrTraCuu ctTraCuu = new ctrTraCuu();
                        this.pnUCtrl.Controls.Add(ctTraCuu);
                        break;
                    case"lichbay":
                        this.pnUCtrl.Controls.Clear();
                        ctrNhanLichChuyenBay ctrLichBay = new ctrNhanLichChuyenBay();
                        this.pnUCtrl.Controls.Add(ctrLichBay);
                        break;
                    case"qlNhanVien":
                        this.pnUCtrl.Controls.Clear();
                        ctrNhanVien ctrnv = new ctrNhanVien();
                        this.pnUCtrl.Controls.Add(ctrnv);
                        break;
                    default:
                        break;
                }
                
            }
            catch (Exception ex)
            {
                
                throw;
            }
        }

        private void frmMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        
    }
}
 